{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
		<!-- form start -->
		<form class="am-form form-validation am-form-full-screen am-form-popup-fixed" action="{{:MyUrl('admin/article/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/article/index', $params)}}">
			<legend>
				<span class="am-text-default">{{:MyLang('article.base_nav_title')}}{{if empty($data['id'])}}{{:MyLang('created_title')}}{{else /}}{{:MyLang('edit_title')}}{{/if}}</span>
				<a href="{{:MyUrl('admin/article/index', $params)}}" class="am-fr am-text-sm am-margin-top-sm am-icon-mail-reply"> {{:MyLang('retreat_title')}}</a>
			</legend>
			<div class="am-cf">
        		<div class="am-u-sm-6 am-padding-horizontal-0">
					<div class="am-form-group">
						<label>{{:MyLang('common_service.article.form_item_title')}}<span class="am-form-group-label-tips-must">*</span></label>
                        <input type="hidden" name="title_color" value="{{if !empty($data['title_color'])}}{{$data.title_color}}{{/if}}" />
						<div class="am-input-group am-input-group-sm">
							<input type="text" name="title" placeholder="{{:MyLang('common_service.article.form_item_title_message')}}" minlength="2" maxlength="60" data-validation-message="{{:MyLang('common_service.article.form_item_title_message')}}" class="am-form-field am-radius" {{if !empty($data['title'])}} value="{{$data.title}}" {{/if}} {{if !empty($data['title_color'])}} style="color:{{$data.title_color}};" {{/if}} required />
							<span class="am-input-group-btn">
								<button class="am-btn am-btn-default am-btn-xs colorpicker-submit" type="button" data-input-tag="input[name='title']" data-color-tag="input[name='title_color']">
									<img src="{{$attachment_host}}/static/common/images/colorpicker.png" />
								</button>
							</span>
						</div>
					</div>
				</div>
				<div class="am-u-sm-6 am-padding-horizontal-0">
					<div class="am-form-group">
						<label>{{:MyLang('common_service.article.form_item_article_category')}}<span class="am-form-group-label-tips-must">*</span></label>
						<select name="article_category_id" class="am-radius chosen-select" data-placeholder="{{:MyLang('optional_tips')}}" data-validation-message="{{:MyLang('common_service.article.form_item_article_category_message')}}" required>
							<option value="">{{:MyLang('optional_tips')}}</option>
							{{foreach $article_category_list as $v}}
								<option value="{{$v.id}}" {{if isset($data['article_category_id']) and $data['article_category_id'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
							{{/foreach}}
						</select>
					</div>
				</div>
			</div>

			<div class="am-cf">
        		<div class="am-u-md-6 am-padding-horizontal-0">
        			<div class="am-form-group">
						<label>{{:MyLang('common_service.article.form_item_jump_url_title')}}<a href="javascript:;" class="am-icon-question-circle am-text-warning am-margin-left-sm" data-am-popover="{content: '{{:MyLang('common_service.article.form_item_jump_url_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a></label>
						<input type="url" name="jump_url" placeholder="{{:MyLang('common_service.article.form_item_jump_url_title')}}" data-validation-message="{{:MyLang('common_service.article.form_item_jump_url_message')}}" class="am-radius" {{if !empty($data['jump_url'])}} value="{{$data.jump_url}}"{{/if}} />
					</div>
        		</div>
        		<div class="am-u-md-6 am-padding-horizontal-0">
        			<div class="am-cf">
        				<div class="am-u-sm-6 am-padding-horizontal-0">
        					{{include file="lib/is_enable" /}}
        				</div>
        				<div class="am-u-sm-6 am-padding-horizontal-0">
        					<div class="am-form-group">
							    <label class="am-block">{{:MyLang('common_service.article.form_item_is_home_recommended_title')}}</label>
							    <input name="is_home_recommended" value="1" type="checkbox" data-off-text="{{:MyLang('no_title')}}" data-on-text="{{:MyLang('yes_title')}}" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if isset($data['is_home_recommended']) and $data['is_home_recommended'] eq 1}}checked="true"{{/if}} />
							</div>
        				</div>
        			</div>
        		</div>
        	</div>

			<div class="am-form-group">
				<label>{{:MyLang('common_service.article.form_item_content_title')}}<span class="am-form-group-label-tips-must">*</span></label>
				<textarea class="am-radius am-validate" name="content" rows="5" minlength="10" maxlength="105000" {{if !IsMobile()}}id="editor-tag" data-url="{{:MyUrl('admin/ueditor/index', ['path_type'=>'article'])}}" placeholder="{{:MyLang('common_service.article.form_item_content_message')}}" {{else /}} placeholder="{{:MyLang('common_service.article.form_item_content_placeholder')}}" {{/if}} data-validation-message="{{:MyLang('common_service.article.form_item_content_message')}}" required>{{if !empty($data['content'])}}{{$data.content}}{{/if}}</textarea>
			</div>

			<!-- 插件扩展数据 start -->
			{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_article_save</span>
                </div>
            {{/if}}
			{{if !empty($plugins_view_admin_article_save_data) and is_array($plugins_view_admin_article_save_data)}}
				<div class="am-alert am-alert-secondary">
					<label class="am-text-sm am-text-warning">{{:MyLang('plugins_view_region_config_tips')}}</label>
					<div>
						{{foreach $plugins_view_admin_article_save_data as $hook}}
		                    {{if is_string($hook) or is_int($hook)}}
		                        {{$hook|raw}}
		                    {{/if}}
		                {{/foreach}}
					</div>
				</div>
			{{/if}}
			<!-- 插件扩展数据 end -->

			<div class="am-panel am-panel-default am-radius am-margin-horizontal-xs am-margin-top">
                <div class="am-panel-bd">
                    {{include file="lib/seo" /}}
                </div>
            </div>

			<div class="am-form-popup-submit">
				<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
				<a href="{{:MyUrl('admin/article/index', $params)}}" class="am-btn am-btn-warning am-radius am-btn-xs am-margin-right-lg">
                    <i class="am-icon-mail-reply"></i>
                    <span>{{:MyLang('retreat_title')}}</span>
                </a>
                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('save_title')}}'}">
                    <i class="am-icon-save"></i>
                    <span>{{:MyLang('save_title')}}</span>
                </button>
			</div>
		</form>
        <!-- form end -->
	</div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->